package adv42;

import java.util.ArrayList;
import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public class ListCupt extends Thread {
    private final List<String> list;

    public ListCupt(String name, List<String> list){
        super(name);
        this.list=list;
    }

    @Override
    public void run() {
        for (int i = 0; i < 10000; i++) {
            list.add("王"+i);
        }
        System.out.println(list.size());
    }

    public static void main(String[] args) {
        List<String> list=new ArrayList<>(1);
        ListCupt t=new ListCupt("线程1",list);
        ListCupt t2=new ListCupt("线程2",list);
        ListCupt t3=new ListCupt("线程3",list);
        t3.start();
        t.start();
        t2.start();

    }
}
